/*
    编写递归函数计算某个编号对应的数字， 1 1 2 3 5 8 13
*/
#include <stdio.h>
/*int func(int arr[],int size,int num) {
    if(num <= 2) {
	return 1;
    }
    if(!arr[num -2]) {
	arr[num - 2] = func(arr, size,num - 2);
    }
    if (!arr[num -1]) {
	arr[num - 1] = func(arr,size,num - 1);
    }
    return arr[num - 2] + arr[num - 1]; 
}*/
//int arr[50];
int func(int num){
    //int arr[50] = {};
    static int arr[50];
    if(num <= 2) {
	return 1;
    }
    if(!arr[num -2]) {
	arr[num - 2] = func(num - 2);
    }
    if (!arr[num -1]) {
	arr[num - 1] = func(num - 1);
    }
    return arr[num - 2] + arr[num - 1]; 
}
int main() {
    //int arr[50] = {};
    int num = 0;
    printf("请输入编号：");
    scanf("%d",&num);
    //printf("%d\n", func(arr,50,num));
    printf("%d\n", func(num));
    return 0;
}
